class Parent {
  constructor(attr) {
    this.attr = attr
  }

  fn() {
    console.log('fn')
  }

  fn2() {
    console.log('fn2')
  }
}

class Child extends Parent {
  constructor() {
    // 调用父类的构造方法
    super(...arguments)
  }

  fn2() {
    // 调用父类的方法
    super.fn2()
  }
}

const child = new Child('attr')
console.log(child.attr)
child.fn()
child.fn2()
